<template>
	<view class="conter">
		<u--input class="input" maxlength="15" placeholder="请输入昵称" clearable border="surround" v-model="nickName">
		</u--input>
		<button @click="updateName">保存</button>
	</view>
</template>

<script>
	import {
		getToken,
		getUserAdmin,
		setUserAdmin
	} from '@/utils/auth'
	import {
		updateNickName
	} from '@/api/account/account.js'
	import {
		toast,
	} from '@/utils/common'
	export default {
		data() {
			return {
				nickName: ''
			}
		},
		onLoad(option) {
			this.nickName = option.nickname;
		},
		methods: {
			// 更改昵称
			updateName() {
				updateNickName(this.nickName).then((res) => {
					if (res.code == 200) {
						setUserAdmin(res.data)
						toast("修改成功");
					}
				})
			},
		}
	}
</script>
<style lang="scss" scoped>
	::v-deep .uni-input-input {
		color: #FFFFFF;
		font-size: 31rpx;
		font-family: "font";
		font-weight: 400;
	}

	.conter {
		padding-top: 50rpx;
	}
	.input {
		width: 680rpx;
		height: 78rpx;
		background-color: #130f25;
		margin-left: 34.88rpx;
		border: 2px solid #130f25 !important;
	}

	button {
		width: 680rpx;
		height: 77rpx;
		background: linear-gradient(270deg, #4463FF 0%, #3ADDEB 100%);
		box-shadow: 3rpx 3rpx 5rpx 0rpx rgba(0, 0, 0, 0.15);
		border-radius: 14rpx;
		opacity: 1;
		font-size: 28rpx;
		font-family: "font";
		font-weight: 800;
		color: #FFFFFF;
		line-height: 78rpx;
		margin: 409.88rpx 34.88rpx;
	}
</style>